/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JDialogMedicineByPatient.java
 *
 * Created on 14/09/2010, 21:43:58
 */
package systole.view.crud.patient.patientComponents.medicines;

import org.jdesktop.application.Action;

/**
 *
 * @author jmj
 */
public class JDialogMedicineByPatient extends javax.swing.JDialog {

    private ControllerEditionMedicineByPatient controller;

    /** Creates new form JDialogMedicineByPatient
     * @param parent
     * @param controller
     */
    public JDialogMedicineByPatient(java.awt.Frame parent, ControllerEditionMedicineByPatient controller) {
        super(parent, true);
        initComponents();
        this.controller = controller;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPnlCenter = new javax.swing.JPanel();
        lblMedicine = new javax.swing.JLabel();
        cmbMedicines = new javax.swing.JComboBox();
        lblDosage = new javax.swing.JLabel();
        lblStartedMeds = new javax.swing.JLabel();
        txtDosage = new javax.swing.JTextField();
        jSpnYears = new javax.swing.JSpinner();
        jLblYears = new javax.swing.JLabel();
        jPnlBottom = new javax.swing.JPanel();
        jBtnOk = new javax.swing.JButton();
        jBtnCancel = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setModal(true);
        setName("Form"); // NOI18N
        setResizable(false);

        jPnlCenter.setName("jPnlCenter"); // NOI18N
        jPnlCenter.setPreferredSize(new java.awt.Dimension(365, 100));

        lblMedicine.setFont(lblMedicine.getFont().deriveFont(lblMedicine.getFont().getStyle() | java.awt.Font.BOLD));
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getResourceMap(JDialogMedicineByPatient.class);
        lblMedicine.setText(resourceMap.getString("lblMedicine.text")); // NOI18N
        lblMedicine.setName("lblMedicine"); // NOI18N

        cmbMedicines.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbMedicines.setToolTipText(resourceMap.getString("cmbMedicines.toolTipText")); // NOI18N
        cmbMedicines.setName("cmbMedicines"); // NOI18N

        lblDosage.setText(resourceMap.getString("lblDosage.text")); // NOI18N
        lblDosage.setName("lblDosage"); // NOI18N

        lblStartedMeds.setText(resourceMap.getString("lblStartedMeds.text")); // NOI18N
        lblStartedMeds.setName("lblStartedMeds"); // NOI18N

        txtDosage.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        txtDosage.setToolTipText(resourceMap.getString("txtDosage.toolTipText")); // NOI18N
        txtDosage.setName("txtDosage"); // NOI18N

        jSpnYears.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
        jSpnYears.setToolTipText(resourceMap.getString("jSpnYears.toolTipText")); // NOI18N
        jSpnYears.setName("jSpnYears"); // NOI18N

        jLblYears.setText(resourceMap.getString("jLblYears.text")); // NOI18N
        jLblYears.setName("jLblYears"); // NOI18N

        javax.swing.GroupLayout jPnlCenterLayout = new javax.swing.GroupLayout(jPnlCenter);
        jPnlCenter.setLayout(jPnlCenterLayout);
        jPnlCenterLayout.setHorizontalGroup(
            jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnlCenterLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblMedicine, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblDosage, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblStartedMeds, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGap(18, 18, 18)
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cmbMedicines, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(txtDosage, javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPnlCenterLayout.createSequentialGroup()
                            .addComponent(jSpnYears, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jLblYears))))
                .addContainerGap(29, Short.MAX_VALUE))
        );
        jPnlCenterLayout.setVerticalGroup(
            jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnlCenterLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPnlCenterLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(lblMedicine))
                    .addComponent(cmbMedicines, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPnlCenterLayout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(lblDosage))
                    .addGroup(jPnlCenterLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtDosage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPnlCenterLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(lblStartedMeds))
                    .addGroup(jPnlCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jSpnYears, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLblYears)))
                .addContainerGap(29, Short.MAX_VALUE))
        );

        getContentPane().add(jPnlCenter, java.awt.BorderLayout.CENTER);

        jPnlBottom.setName("jPnlBottom"); // NOI18N
        jPnlBottom.setPreferredSize(new java.awt.Dimension(313, 40));

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(systole.view.SystoleApp.class).getContext().getActionMap(JDialogMedicineByPatient.class, this);
        jBtnOk.setAction(actionMap.get("ok")); // NOI18N
        jBtnOk.setText(resourceMap.getString("jBtnOk.text")); // NOI18N
        jBtnOk.setToolTipText(resourceMap.getString("jBtnOk.toolTipText")); // NOI18N
        jBtnOk.setName("jBtnOk"); // NOI18N
        jPnlBottom.add(jBtnOk);

        jBtnCancel.setAction(actionMap.get("cancel")); // NOI18N
        jBtnCancel.setText(resourceMap.getString("jBtnCancel.text")); // NOI18N
        jBtnCancel.setToolTipText(resourceMap.getString("jBtnCancel.toolTipText")); // NOI18N
        jBtnCancel.setName("jBtnCancel"); // NOI18N
        jPnlBottom.add(jBtnCancel);

        getContentPane().add(jPnlBottom, java.awt.BorderLayout.SOUTH);

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox cmbMedicines;
    private javax.swing.JButton jBtnCancel;
    private javax.swing.JButton jBtnOk;
    private javax.swing.JLabel jLblYears;
    private javax.swing.JPanel jPnlBottom;
    private javax.swing.JPanel jPnlCenter;
    private javax.swing.JSpinner jSpnYears;
    private javax.swing.JLabel lblDosage;
    private javax.swing.JLabel lblMedicine;
    private javax.swing.JLabel lblStartedMeds;
    private javax.swing.JTextField txtDosage;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the cmbMedicines
     */
    public javax.swing.JComboBox getCmbMedicines() {
        return cmbMedicines;
    }

  
    /**
     * @return the txtDosage
     */
    public javax.swing.JTextField getTxtDosage() {
        return txtDosage;
    }

    /**
     * Confirm operation
     */
    @Action
    public void ok() {
        this.controller.ok();
    }

    /**
     * Cancel operation
     */
    @Action
    public void cancel() {
        this.controller.cancel();
    }

    /**
     * @return the jSpnYears
     */
    public javax.swing.JSpinner getjSpnYears() {
        return jSpnYears;
    }


}
